{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "source": [
        "<a href=\"https://colab.research.google.com/drive/1HLxEVsGfXvEm73Rszwd-ucUW6wkQtE9e?usp=sharing\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"></a>"
      ],
      "metadata": {
        "id": "EnyB718NFsVY"
      }
    },
    {
      "cell_type": "markdown",
      "source": [
        "### Generative Agents"
      ],
      "metadata": {
        "id": "0Pgu-Kjkb5oC"
      }
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "id": "emTSJF4v1rPM"
      },
      "outputs": [],
      "source": [
        "!pip install -qU google-generativeai"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "import google.generativeai as genai\n",
        "import getpass\n",
        "from datetime import datetime"
      ],
      "metadata": {
        "id": "40c8c9X6b9qq"
      },
      "execution_count": 2,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "source": [
        "Get free-tier Google's Gemini API Key here: https://aistudio.google.com/app/apikey"
      ],
      "metadata": {
        "id": "3RXO9hRacCi-"
      }
    },
    {
      "cell_type": "code",
      "source": [
        "API_KEY = getpass.getpass(\"Enter your Google API key: \")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "lDzhZwanb_gO",
        "outputId": "51b00ca5-3915-4156-c5e6-359e568baa09"
      },
      "execution_count": 6,
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Enter your Google API key: ··········\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "genai.configure(api_key=API_KEY)"
      ],
      "metadata": {
        "id": "xH2gxoeRchb2"
      },
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "class GenerativeAgent:\n",
        "    def __init__(self, name):\n",
        "        self.model = genai.GenerativeModel(\"gemini-2.0-flash\")\n",
        "        self.name = name\n",
        "        self.memory_stream = []  # All observations\n",
        "        self.reflections = []    # High-level insights\n",
        "        self.environment = {}    # Current environment state\n",
        "\n",
        "    def observe(self, observation):\n",
        "        \"\"\"Record observation in memory stream\"\"\"\n",
        "        memory = {\n",
        "            \"time\": datetime.now().strftime(\"%H:%M\"),\n",
        "            \"type\": \"observation\",\n",
        "            \"content\": observation\n",
        "        }\n",
        "        self.memory_stream.append(memory)\n",
        "        print(f\"👁️  {self.name} observed: {observation}\")\n",
        "\n",
        "    def reflect(self):\n",
        "        \"\"\"Generate insights from recent memories\"\"\"\n",
        "        if len(self.memory_stream) < 3:\n",
        "            return\n",
        "\n",
        "        recent = \"\\n\".join([m[\"content\"] for m in self.memory_stream[-5:]])\n",
        "\n",
        "        prompt = f\"\"\"Based on these observations, generate 2-3 high-level insights:\n",
        "\n",
        "        {recent}\n",
        "\n",
        "        Insights:\"\"\"\n",
        "\n",
        "        response = self.model.generate_content(prompt).text\n",
        "\n",
        "        reflection = {\n",
        "            \"time\": datetime.now().strftime(\"%H:%M\"),\n",
        "            \"type\": \"reflection\",\n",
        "            \"content\": response.strip()\n",
        "        }\n",
        "        self.reflections.append(reflection)\n",
        "        print(f\"💭 {self.name} reflected: {response.strip()}\\n\")\n",
        "\n",
        "    def plan(self, goal):\n",
        "        \"\"\"Create action plan based on memories and environment\"\"\"\n",
        "        memories = \"\\n\".join([m[\"content\"] for m in self.memory_stream[-3:]])\n",
        "        insights = \"\\n\".join([r[\"content\"] for r in self.reflections[-2:]])\n",
        "        env = str(self.environment)\n",
        "\n",
        "        prompt = f\"\"\"You are {self.name}. Create a short action plan.\n",
        "\n",
        "        Goal: {goal}\n",
        "\n",
        "        Recent memories:\n",
        "        {memories}\n",
        "\n",
        "        Insights:\n",
        "        {insights if insights else \"None yet\"}\n",
        "\n",
        "        Environment:\n",
        "        {env}\n",
        "\n",
        "        Plan (3-5 actions):\"\"\"\n",
        "\n",
        "        plan = self.model.generate_content(prompt).text\n",
        "        print(f\"📋 {self.name}'s plan:\\n{plan}\\n\")\n",
        "        return plan.strip()\n",
        "\n",
        "    def act(self, action, environment):\n",
        "        \"\"\"Take action and update environment\"\"\"\n",
        "        print(f\"⚡ {self.name} action: {action}\")\n",
        "\n",
        "        # Simulate action effect on environment\n",
        "        prompt = f\"\"\"An agent performed this action: {action}\n",
        "\n",
        "        Current environment:\n",
        "        {environment}\n",
        "\n",
        "        How does the environment change? Respond with key-value pairs.\n",
        "        Format: key: new_value\n",
        "\n",
        "        Changes:\"\"\"\n",
        "\n",
        "        response = self.model.generate_content(prompt).text\n",
        "\n",
        "        # Parse environment changes\n",
        "        for line in response.split(\"\\n\"):\n",
        "            if \":\" in line:\n",
        "                key, val = line.split(\":\", 1)\n",
        "                environment[key.strip()] = val.strip()\n",
        "\n",
        "        print(f\"🌍 Environment updated: {environment}\\n\")\n",
        "        return environment\n",
        "\n",
        "    def run_cycle(self, goal, steps=5):\n",
        "        \"\"\"Run observe-reflect-plan-act cycle\"\"\"\n",
        "        print(f\"\\n{'='*60}\")\n",
        "        print(f\"🎯 {self.name}: {goal}\")\n",
        "        print(f\"{'='*60}\\n\")\n",
        "\n",
        "        for i in range(steps):\n",
        "            print(f\"--- Cycle {i+1} ---\\n\")\n",
        "\n",
        "            # Observe environment\n",
        "            self.observe(f\"Environment state: {self.environment}\")\n",
        "\n",
        "            # Reflect periodically\n",
        "            if i > 0 and i % 2 == 0:\n",
        "                self.reflect()\n",
        "\n",
        "            # Plan next action\n",
        "            plan = self.plan(goal)\n",
        "\n",
        "            # Extract first action from plan\n",
        "            action = plan.split(\"\\n\")[0].strip()\n",
        "\n",
        "            # Act and update environment\n",
        "            self.environment = self.act(action, self.environment)\n",
        "\n",
        "            # Record action in memory\n",
        "            self.memory_stream.append({\n",
        "                \"time\": datetime.now().strftime(\"%H:%M\"),\n",
        "                \"type\": \"action\",\n",
        "                \"content\": action\n",
        "            })\n",
        "\n",
        "        print(f\"✅ Goal completed: {goal}\\n\")\n",
        "        self.show_summary()\n",
        "\n",
        "    def show_summary(self):\n",
        "        \"\"\"Show agent's memory and insights\"\"\"\n",
        "        print(f\"{'='*60}\")\n",
        "        print(f\"📊 {self.name}'s Summary\")\n",
        "        print(f\"{'='*60}\")\n",
        "        print(f\"Memories: {len(self.memory_stream)}\")\n",
        "        print(f\"Reflections: {len(self.reflections)}\")\n",
        "        print(f\"Final environment: {self.environment}\")\n",
        "\n",
        "        if self.reflections:\n",
        "            print(f\"\\nKey insights:\")\n",
        "            for r in self.reflections[-2:]:\n",
        "                print(f\"  • {r['content'][:80]}...\")"
      ],
      "metadata": {
        "id": "Yn2IEJ6NcH9t"
      },
      "execution_count": 9,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# Example 1: Research Assistant Agent\n",
        "print(\"=\"*60)\n",
        "print(\"EXAMPLE 1: Research Assistant Agent\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "researcher = GenerativeAgent(\"ResearchBot\")\n",
        "researcher.environment = {\n",
        "    \"papers_read\": 0,\n",
        "    \"notes\": \"empty\",\n",
        "    \"draft\": \"not started\"\n",
        "}\n",
        "\n",
        "researcher.run_cycle(\"Research AI agents and write summary\", steps=4)\n",
        "\n",
        "\n",
        "# Example 2: Customer Service Agent\n",
        "print(\"\\n\" + \"=\"*60)\n",
        "print(\"EXAMPLE 2: Customer Service Agent\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "cs_agent = GenerativeAgent(\"SupportBot\")\n",
        "cs_agent.environment = {\n",
        "    \"tickets\": 5,\n",
        "    \"customer_satisfaction\": \"unknown\",\n",
        "    \"resolved\": 0\n",
        "}\n",
        "\n",
        "cs_agent.run_cycle(\"Handle customer support tickets\", steps=3)\n",
        "\n",
        "\n",
        "# Example 3: Multi-agent simulation\n",
        "print(\"\\n\" + \"=\"*60)\n",
        "print(\"EXAMPLE 3: Multi-Agent Collaboration\")\n",
        "print(\"=\"*60)\n",
        "\n",
        "manager = GenerativeAgent(\"Manager\")\n",
        "developer = GenerativeAgent(\"Developer\")\n",
        "\n",
        "# Shared environment\n",
        "shared_env = {\n",
        "    \"project_status\": \"not started\",\n",
        "    \"tasks\": 10,\n",
        "    \"completed\": 0\n",
        "}\n",
        "\n",
        "manager.environment = shared_env.copy()\n",
        "developer.environment = shared_env.copy()\n",
        "\n",
        "print(\"--- Manager's turn ---\")\n",
        "manager.observe(\"New project assigned with 10 tasks\")\n",
        "plan = manager.plan(\"Organize project and assign tasks\")\n",
        "action = plan.split(\"\\n\")[0]\n",
        "shared_env = manager.act(action, shared_env)\n",
        "\n",
        "print(\"\\n--- Developer's turn ---\")\n",
        "developer.environment = shared_env.copy()\n",
        "developer.observe(f\"Manager assigned tasks: {shared_env}\")\n",
        "dev_plan = developer.plan(\"Complete assigned tasks\")\n",
        "dev_action = dev_plan.split(\"\\n\")[0]\n",
        "shared_env = developer.act(dev_action, shared_env)\n",
        "\n",
        "print(f\"\\n🌍 Final shared environment: {shared_env}\")"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        },
        "id": "6owv70F2cN8M",
        "outputId": "db1f56ee-a228-4e87-e423-32bde9b79a6b"
      },
      "execution_count": 10,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "============================================================\n",
            "EXAMPLE 1: Research Assistant Agent\n",
            "============================================================\n",
            "\n",
            "============================================================\n",
            "🎯 ResearchBot: Research AI agents and write summary\n",
            "============================================================\n",
            "\n",
            "--- Cycle 1 ---\n",
            "\n",
            "👁️  ResearchBot observed: Environment state: {'papers_read': 0, 'notes': 'empty', 'draft': 'not started'}\n",
            "📋 ResearchBot's plan:\n",
            "Okay, here's a short action plan to start researching AI agents and writing a summary:\n",
            "\n",
            "1.  **Identify Relevant Keywords:** Brainstorm and list keywords related to AI agents (e.g., \"autonomous agents,\" \"intelligent agents,\" \"multi-agent systems,\" \"AI agent architectures,\" \"reinforcement learning agents,\" \"cognitive agents\").\n",
            "2.  **Search for Initial Papers:** Use a search engine (e.g., Google Scholar, arXiv) to find 2-3 highly cited or recent survey papers/review articles on AI agents using the keywords.\n",
            "3.  **Read and Take Notes on Paper 1:**  Read the abstract and introduction of the first paper to understand the scope. If relevant, skim the rest of the paper, taking brief notes on key concepts, architectures, and applications.\n",
            "4. **Add Notes:** Save the notes to document (either by modifying the existing notes or creating a new document)\n",
            "\n",
            "This plan focuses on quickly acquiring a basic understanding of the field.\n",
            "\n",
            "\n",
            "⚡ ResearchBot action: Okay, here's a short action plan to start researching AI agents and writing a summary:\n",
            "🌍 Environment updated: {'papers_read': 0, 'notes': 'started', 'draft': 'not started'}\n",
            "\n",
            "--- Cycle 2 ---\n",
            "\n",
            "👁️  ResearchBot observed: Environment state: {'papers_read': 0, 'notes': 'started', 'draft': 'not started'}\n",
            "📋 ResearchBot's plan:\n",
            "Here's a 5-action plan to kickstart the AI agent research and summary:\n",
            "\n",
            "1.  **Search for relevant research papers:** Conduct online searches using keywords like \"AI agents\", \"autonomous agents\", \"multi-agent systems\", \"reinforcement learning agents\", and \"cognitive architectures\".\n",
            "2.  **Identify and prioritize 3-5 key papers:** Skim through search results and select a few papers that appear most relevant and impactful to provide a good overview of the field. Prioritize review articles or surveys.\n",
            "3.  **Read the abstract and introduction of the first paper.**\n",
            "4.  **Begin taking notes on key concepts, definitions, and important research directions from the first paper.** Add those notes to \"notes\".\n",
            "5.  **Store paper**: Store the pdf of the first paper in the workspace.\n",
            "\n",
            "\n",
            "⚡ ResearchBot action: Here's a 5-action plan to kickstart the AI agent research and summary:\n",
            "🌍 Environment updated: {'papers_read': 0, 'notes': 'started planning', 'draft': 'not started'}\n",
            "\n",
            "--- Cycle 3 ---\n",
            "\n",
            "👁️  ResearchBot observed: Environment state: {'papers_read': 0, 'notes': 'started planning', 'draft': 'not started'}\n",
            "💭 ResearchBot reflected: Here are 2 high-level insights based on the observations:\n",
            "\n",
            "1. **The process begins with note-taking and planning before reading papers or drafting.** The actions taken prioritize setting up a framework for research and summarization (notes and planning) before diving into the source material (papers). This suggests a deliberate approach to understanding and organizing information.\n",
            "\n",
            "2. **Initial actions focus on preparation rather than immediate execution.** The system is spending time in preliminary stages like planning and note-taking without yet engaging in activities like reading papers or drafting the summary. This indicates that early phases emphasize structuring the task and gathering initial thoughts.\n",
            "\n",
            "📋 ResearchBot's plan:\n",
            "Here's an updated 5-action plan to research AI agents and write a summary, building on the initial planning:\n",
            "\n",
            "1.  **Search and Identify Relevant Papers (Web Search):** Conduct a targeted web search to find 3-5 seminal or recent papers on AI agents. Focus on review articles, surveys, and papers discussing different types of AI agents (e.g., autonomous agents, reinforcement learning agents, etc.).\n",
            "\n",
            "2.  **Read and Annotate First Paper:** Select the most relevant paper from the search results. Read the abstract, introduction, and conclusion carefully. Take detailed notes on the key concepts, definitions, architectures, and applications discussed in the paper. Add these notes to the existing notes document.\n",
            "\n",
            "3.  **Refine Search Terms Based on Paper 1:** Based on the keywords and concepts identified in the first paper, refine the search terms for subsequent searches. This helps to narrow down the search and find more specific and relevant papers.\n",
            "\n",
            "4. **Read and Annotate Second Paper:** Select another relevant paper from the search results. Read it, focusing on comparing and contrasting its approaches with the first paper. Add detailed notes, highlighting similarities, differences, and any novel contributions.\n",
            "\n",
            "5. **Outline Draft Structure:** Based on the notes from the two papers, create a preliminary outline for the summary. This outline should include sections such as \"Introduction to AI Agents,\" \"Types of AI Agents,\" \"Key Concepts and Architectures,\" \"Applications,\" and \"Future Directions.\"\n",
            "\n",
            "\n",
            "⚡ ResearchBot action: Here's an updated 5-action plan to research AI agents and write a summary, building on the initial planning:\n",
            "🌍 Environment updated: {'papers_read': 0, 'notes': 'started planning, updated plan', 'draft': 'not started'}\n",
            "\n",
            "--- Cycle 4 ---\n",
            "\n",
            "👁️  ResearchBot observed: Environment state: {'papers_read': 0, 'notes': 'started planning, updated plan', 'draft': 'not started'}\n",
            "📋 ResearchBot's plan:\n",
            "Here's a 5-action plan to research AI agents and write a summary:\n",
            "\n",
            "1. **Search for relevant research papers on AI agents.** (Action: `web_search` query: \"recent research AI agents\")\n",
            "2. **Read the abstracts and introductions of the top 3 search results and save potentially relevant papers.** (Action: `read_paper` paper_id: [Top 3 search results])\n",
            "3. **Take detailed notes on key concepts, methodologies, and findings from the selected papers.** (Action: `note_taking` topic: \"Key concepts from AI agent research papers\")\n",
            "4. **Outline the structure of the summary based on the research notes.** (Action: `outline` topic: \"Summary of AI agent research\")\n",
            "5. **Begin drafting the summary based on the outline and research notes.** (Action: `draft` topic: \"Initial draft of AI agent research summary\")\n",
            "\n",
            "\n",
            "⚡ ResearchBot action: Here's a 5-action plan to research AI agents and write a summary:\n",
            "🌍 Environment updated: {'papers_read': 0, 'notes': 'started planning, updated plan, outlined 5-action plan', 'draft': 'not started'}\n",
            "\n",
            "✅ Goal completed: Research AI agents and write summary\n",
            "\n",
            "============================================================\n",
            "📊 ResearchBot's Summary\n",
            "============================================================\n",
            "Memories: 8\n",
            "Reflections: 1\n",
            "Final environment: {'papers_read': 0, 'notes': 'started planning, updated plan, outlined 5-action plan', 'draft': 'not started'}\n",
            "\n",
            "Key insights:\n",
            "  • Here are 2 high-level insights based on the observations:\n",
            "\n",
            "1. **The process begi...\n",
            "\n",
            "============================================================\n",
            "EXAMPLE 2: Customer Service Agent\n",
            "============================================================\n",
            "\n",
            "============================================================\n",
            "🎯 SupportBot: Handle customer support tickets\n",
            "============================================================\n",
            "\n",
            "--- Cycle 1 ---\n",
            "\n",
            "👁️  SupportBot observed: Environment state: {'tickets': 5, 'customer_satisfaction': 'unknown', 'resolved': 0}\n",
            "📋 SupportBot's plan:\n",
            "Okay, here's my action plan to start handling these support tickets:\n",
            "\n",
            "1. **Prioritize Tickets:** Scan the tickets to identify any high-priority issues (e.g., system outage, urgent requests). I'll need more information to do this effectively in the future, but for now, I'll assume they are all equal priority.\n",
            "2. **Acknowledge Receipt:** Send an automated reply to each ticket acknowledging receipt and setting expectations for response time.  This will improve the 'customer_satisfaction' metric.\n",
            "3. **Triage First Ticket:** Select the first ticket and analyze its content to understand the issue.\n",
            "4. **Begin Resolution:** Based on the issue identified in step 3, take the first step toward resolution. This might involve looking up information in a knowledge base, escalating to a human, or providing a direct solution.\n",
            "\n",
            "\n",
            "⚡ SupportBot action: Okay, here's my action plan to start handling these support tickets:\n",
            "🌍 Environment updated: {'tickets': '4', 'customer_satisfaction': 'unknown', 'resolved': '1'}\n",
            "\n",
            "--- Cycle 2 ---\n",
            "\n",
            "👁️  SupportBot observed: Environment state: {'tickets': '4', 'customer_satisfaction': 'unknown', 'resolved': '1'}\n",
            "📋 SupportBot's plan:\n",
            "Okay, I'm ready to tackle these tickets. Here's my plan:\n",
            "\n",
            "1.  **Prioritize Tickets:** Examine the remaining 4 tickets and determine if any are marked urgent or have specific keywords (e.g., \"account locked\", \"payment issue\") that require immediate attention. If not, I will process the tickets in the order they were received.\n",
            "2.  **Acknowledge Ticket:** Select the oldest, or most urgent, ticket and send an automated acknowledgement message to the customer, letting them know their request has been received and is being reviewed. This manages expectations and improves customer satisfaction.\n",
            "3.  **Investigate and Resolve:** Based on the ticket description, begin investigating the issue. I will utilize my knowledge base to find potential solutions. Aim to fully resolve at least one ticket.\n",
            "4.  **Document Resolution:** After resolving the ticket, clearly document the steps taken and the resolution provided. This is crucial for future reference and training.\n",
            "5. **Check customer satisfication:** Check satisfaction based on ticket id that was resolved.\n",
            "\n",
            "\n",
            "⚡ SupportBot action: Okay, I'm ready to tackle these tickets. Here's my plan:\n",
            "🌍 Environment updated: {'tickets': '4', 'customer_satisfaction': 'unknown', 'resolved': '1'}\n",
            "\n",
            "--- Cycle 3 ---\n",
            "\n",
            "👁️  SupportBot observed: Environment state: {'tickets': '4', 'customer_satisfaction': 'unknown', 'resolved': '1'}\n",
            "💭 SupportBot reflected: Here are a few high-level insights based on the provided observations:\n",
            "\n",
            "1.  **Initial Ticket Load is Manageable:** The initial number of tickets (5) suggests a potentially manageable workload. The system is not immediately overwhelmed.\n",
            "2.  **Early Resolution Occurs:** The state transitions indicate that tickets are being resolved relatively quickly. The system moves from 5 tickets to 4 tickets with 1 resolved in a short timeframe.\n",
            "3.  **Customer Satisfaction is a Key Unknown:** The 'customer_satisfaction' remaining consistently 'unknown' highlights a crucial information gap. Measuring and tracking customer satisfaction should be a priority to gauge the effectiveness of the resolution process.\n",
            "\n",
            "📋 SupportBot's plan:\n",
            "Okay, I have 4 unresolved tickets and need to improve customer satisfaction visibility. Here's my action plan:\n",
            "\n",
            "1.  **Prioritize and Categorize:** Quickly assess the remaining 4 tickets to understand the nature of the issues (e.g., bug reports, feature requests, account problems). Tag them with appropriate categories.\n",
            "2.  **Address Simple Issues First:** Look for tickets that can be resolved quickly and efficiently based on existing knowledge or canned responses. Aim for quick wins to reduce the ticket backlog.\n",
            "3.  **Investigate Complex Issues:** Dedicate focused time to understand and troubleshoot the more complex tickets that require deeper investigation or collaboration.\n",
            "4.  **Implement Customer Satisfaction Feedback:** Begin implementing a method for gathering customer satisfaction data *after* ticket resolution (e.g., a short survey or rating request). This data is critical for improving service.\n",
            "\n",
            "\n",
            "⚡ SupportBot action: Okay, I have 4 unresolved tickets and need to improve customer satisfaction visibility. Here's my action plan:\n",
            "🌍 Environment updated: {'tickets': '4', 'customer_satisfaction': 'low', 'resolved': '1'}\n",
            "\n",
            "✅ Goal completed: Handle customer support tickets\n",
            "\n",
            "============================================================\n",
            "📊 SupportBot's Summary\n",
            "============================================================\n",
            "Memories: 6\n",
            "Reflections: 1\n",
            "Final environment: {'tickets': '4', 'customer_satisfaction': 'low', 'resolved': '1'}\n",
            "\n",
            "Key insights:\n",
            "  • Here are a few high-level insights based on the provided observations:\n",
            "\n",
            "1.  **In...\n",
            "\n",
            "============================================================\n",
            "EXAMPLE 3: Multi-Agent Collaboration\n",
            "============================================================\n",
            "--- Manager's turn ---\n",
            "👁️  Manager observed: New project assigned with 10 tasks\n",
            "📋 Manager's plan:\n",
            "Okay, here's my action plan to organize the project and assign tasks:\n",
            "\n",
            "1. **Task Breakdown & Prioritization (High Priority):**  Review the 10 tasks in detail. Break down any overly broad tasks into smaller, more manageable sub-tasks if needed.  Prioritize tasks based on dependencies and overall project timeline. *Goal: Define scope and prioritize effort.*\n",
            "\n",
            "2. **Team Skillset Assessment (High Priority):** Identify the skills required for each task and sub-task. Assess the team's individual strengths and areas of expertise to determine the best fit for task assignments. *Goal: Match talent to task.*\n",
            "\n",
            "3. **Task Assignment & Communication (Medium Priority):**  Assign specific tasks (and sub-tasks, if applicable) to team members. Communicate the task assignments clearly, outlining expectations, deadlines, and any relevant resources or information. *Goal: Delegate tasks efficiently.*\n",
            "\n",
            "4. **Initial Project Kick-off Meeting (Medium Priority):** Schedule a brief project kick-off meeting with the team to review the project goals, scope, timeline, and individual task assignments. This will foster clarity and ensure everyone is on the same page. *Goal: Ensure team alignment.*\n",
            "\n",
            "\n",
            "⚡ Manager action: Okay, here's my action plan to organize the project and assign tasks:\n",
            "🌍 Environment updated: {'project_status': 'in progress', 'tasks': 10, 'completed': 0}\n",
            "\n",
            "\n",
            "--- Developer's turn ---\n",
            "👁️  Developer observed: Manager assigned tasks: {'project_status': 'in progress', 'tasks': 10, 'completed': 0}\n",
            "📋 Developer's plan:\n",
            "Okay, here's a short action plan to get started on those tasks:\n",
            "\n",
            "**Plan:**\n",
            "\n",
            "1.  **Prioritize Tasks:** Briefly review the 10 tasks and identify any dependencies or urgency.  This will help determine the best order to tackle them. (Expected time: 15 minutes)\n",
            "2.  **Select First Task:** Choose the highest priority task to begin working on.\n",
            "3.  **Execute and Test:** Work on the selected task to completion, including thorough testing.\n",
            "4.  **Document Progress:** Once the task is complete, document any relevant details (code changes, issues encountered, solutions implemented) and update the progress tracker.\n",
            "5.  **Report Completion:** Inform the manager that the first task is completed.\n",
            "\n",
            "This plan focuses on quickly getting started, establishing a rhythm, and ensuring proper documentation and communication.\n",
            "\n",
            "\n",
            "⚡ Developer action: Okay, here's a short action plan to get started on those tasks:\n",
            "🌍 Environment updated: {'project_status': 'in progress', 'tasks': '9', 'completed': 0}\n",
            "\n",
            "\n",
            "🌍 Final shared environment: {'project_status': 'in progress', 'tasks': '9', 'completed': 0}\n"
          ]
        }
      ]
    },
    {
      "cell_type": "code",
      "source": [],
      "metadata": {
        "id": "Q_jz2S6scaAX"
      },
      "execution_count": null,
      "outputs": []
    }
  ]
}